package play;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import util.Settings;

/**
 * Guidance screen for new games.
 * @author VincentLy
 */
public class Guide extends BasicGameState{
	
	private String s1 = "General Guidance";
	private String s2 = "If you find yourself having trouble, press 'p' to pause once you are in the world.";
	private String s3 = "On the pause menu, click the help menu for basic controls.";
	private String s4 = "Walk into the spinning portals to warp to the battle stage, where you will fight enemies.";
	private String s5 = "Walk into doors by pressing 'j' back in the world to explore new places.";
	private String s6 = "Have fun, and press space to start...";
	
	public Guide(){super();}

	/**
	 * No initialization needed yet.
	 * @author VincentLy
	 */
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {}

	/**
	 * Checks to see whenever the user advances.
	 * @author VincentLy
	 */
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		Input i = gc.getInput();
		if(i.isKeyPressed(Input.KEY_SPACE)){
			if(Settings.retry)
				sbg.getState(Settings.wID).init(gc,sbg);
			sbg.enterState(Settings.wID);	
		}	
	}
	
	/**
	 * Draws the text onto the screen.
	 * @author VincentLy
	 */
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		g.setAntiAlias(true);
		g.setBackground(Settings.bg);
		g.setColor(Settings.screenText);
		g.drawString(s1,(Settings.screenX-g.getFont().getWidth(s1))/2,g.getFont().getHeight(s1));
		g.drawString(s2,(Settings.screenX-g.getFont().getWidth(s2))/2,200);
		g.drawString(s3,(Settings.screenX-g.getFont().getWidth(s3))/2,250);
		g.drawString(s4,(Settings.screenX-g.getFont().getWidth(s4))/2,300);
		g.drawString(s5,(Settings.screenX-g.getFont().getWidth(s5))/2,350);
		g.drawString(s6,(Settings.screenX-g.getFont().getWidth(s6))/2,400);
	}

	/**
	 * @return id
	 * @author VincentLy
	 */
	public int getID() {return Settings.gID;}
}